package com.example.photo.model.domain;

import com.baomidou.mybatisplus.annotation.*;
import com.example.photo.model.request.update.UpdateContestRequest;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * 赛事
 * @TableName contest
 */
@TableName(value ="contest")
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Contest implements Serializable {
    /**
     * 赛事id
     */
    @TableId(type = IdType.AUTO)
    private Integer contestId;

    /**
     * 主图（图片）
     */
    private String bannerPic;

    /**
     * 主题
     */
    private String title;

    /**
     * 副标题
     */
    private String subtitle;

    /**
     * 开始时间
     */
    private LocalDateTime startTime;

    /**
     * 结束时间
     */
    private LocalDateTime stopTime;

    /**
     * 赛事介绍（图片）
     */
    private String introductionPic;

    /**
     * 赛事状态
     */
    private Integer status;

    /**
     * 奖项后插图（图片）
     */
    private String tailPic;

    /**
     * 问卷星链接
     */
    private String questionnaire;

    /**
     * 是否删除
     */
    @TableLogic
    private Integer isDeleted;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    public Contest(UpdateContestRequest updateContestRequest) {
        this.contestId = updateContestRequest.getContestId();
        this.bannerPic = updateContestRequest.getBannerPic();
        this.title = updateContestRequest.getTitle();
        this.subtitle = updateContestRequest.getSubtitle();
        this.startTime = updateContestRequest.getStartTime();
        this.stopTime = updateContestRequest.getStopTime();
        this.introductionPic = updateContestRequest.getIntroductionPic();
        this.status = updateContestRequest.getStatus();
        this.tailPic = updateContestRequest.getTailPic();
        this.questionnaire = updateContestRequest.getQuestionnaire();
    }
}